﻿<UserControl
    x:Class="Results.Views.MainView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Icons="clr-namespace:Results.Icons"
    xmlns:Views="clr-namespace:Results.Views"
    mc:Ignorable="d"
    d:DesignHeight="300"
    ScrollViewer.VerticalScrollBarVisibility="Visible">
    <Grid
        x:Name="LayoutRoot"
        Background="LightGray">
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup
                x:Name="VisualStateGroup">
                <VisualState
                    x:Name="Players">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames
                            BeginTime="00:00:00"
                            Duration="00:00:00.0010000"
                            Storyboard.TargetName="playersView"
                            Storyboard.TargetProperty="(UIElement.Visibility)">
                            <DiscreteObjectKeyFrame
                                KeyTime="00:00:00">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Visible</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames
                            BeginTime="00:00:00"
                            Duration="00:00:00.0010000"
                            Storyboard.TargetName="playersButton"
                            Storyboard.TargetProperty="(Control.FontWeight)">
                            <DiscreteObjectKeyFrame
                                KeyTime="00:00:00">
                                <DiscreteObjectKeyFrame.Value>
                                    <FontWeight>Bold</FontWeight>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames
                            BeginTime="00:00:00"
                            Duration="00:00:00.0010000"
                            Storyboard.TargetName="groupsView"
                            Storyboard.TargetProperty="(UIElement.Visibility)">
                            <DiscreteObjectKeyFrame
                                KeyTime="00:00:00">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Visible</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames
                            BeginTime="00:00:00"
                            Duration="00:00:00.0010000"
                            Storyboard.TargetName="seasonsView"
                            Storyboard.TargetProperty="(UIElement.Visibility)">
                            <DiscreteObjectKeyFrame
                                KeyTime="00:00:00">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Visible</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState
                    x:Name="Player">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames
                            BeginTime="00:00:00"
                            Duration="00:00:00.0010000"
                            Storyboard.TargetName="playerView"
                            Storyboard.TargetProperty="(UIElement.Visibility)">
                            <DiscreteObjectKeyFrame
                                KeyTime="00:00:00">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Visible</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames
                            BeginTime="00:00:00"
                            Duration="00:00:00.0010000"
                            Storyboard.TargetName="selectedPlayerButton"
                            Storyboard.TargetProperty="(Control.FontWeight)">
                            <DiscreteObjectKeyFrame
                                KeyTime="00:00:00">
                                <DiscreteObjectKeyFrame.Value>
                                    <FontWeight>Bold</FontWeight>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames
                            BeginTime="00:00:00"
                            Duration="00:00:00.0010000"
                            Storyboard.TargetName="SelectedSeasonAndGroup"
                            Storyboard.TargetProperty="(UIElement.Visibility)">
                            <DiscreteObjectKeyFrame
                                KeyTime="00:00:00">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Collapsed</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState
                    x:Name="Tournaments">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames
                            BeginTime="00:00:00"
                            Duration="00:00:00.0010000"
                            Storyboard.TargetName="tournamentsView"
                            Storyboard.TargetProperty="(UIElement.Visibility)">
                            <DiscreteObjectKeyFrame
                                KeyTime="00:00:00">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Visible</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames
                            BeginTime="00:00:00"
                            Duration="00:00:00.0010000"
                            Storyboard.TargetName="tournamentsButton"
                            Storyboard.TargetProperty="(Control.FontWeight)">
                            <DiscreteObjectKeyFrame
                                KeyTime="00:00:00">
                                <DiscreteObjectKeyFrame.Value>
                                    <FontWeight>Bold</FontWeight>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames
                            BeginTime="00:00:00"
                            Duration="00:00:00.0010000"
                            Storyboard.TargetName="groupsView"
                            Storyboard.TargetProperty="(UIElement.Visibility)">
                            <DiscreteObjectKeyFrame
                                KeyTime="00:00:00">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Visible</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames
                            BeginTime="00:00:00"
                            Duration="00:00:00.0010000"
                            Storyboard.TargetName="seasonsView"
                            Storyboard.TargetProperty="(UIElement.Visibility)">
                            <DiscreteObjectKeyFrame
                                KeyTime="00:00:00">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Visible</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState
                    x:Name="Tournament">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames
                            BeginTime="00:00:00"
                            Duration="00:00:00.0010000"
                            Storyboard.TargetName="tournamentView"
                            Storyboard.TargetProperty="(UIElement.Visibility)">
                            <DiscreteObjectKeyFrame
                                KeyTime="00:00:00">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Visible</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames
                            BeginTime="00:00:00"
                            Duration="00:00:00.0010000"
                            Storyboard.TargetName="selectedTournamentButton"
                            Storyboard.TargetProperty="(Control.FontWeight)">
                            <DiscreteObjectKeyFrame
                                KeyTime="00:00:00">
                                <DiscreteObjectKeyFrame.Value>
                                    <FontWeight>Bold</FontWeight>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames
                            BeginTime="00:00:00"
                            Duration="00:00:00.0010000"
                            Storyboard.TargetName="groupsView"
                            Storyboard.TargetProperty="(UIElement.Visibility)">
                            <DiscreteObjectKeyFrame
                                KeyTime="00:00:00">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Visible</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState
                    x:Name="Rankings">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames
                            BeginTime="00:00:00"
                            Duration="00:00:00.0010000"
                            Storyboard.TargetName="rankingsView"
                            Storyboard.TargetProperty="(UIElement.Visibility)">
                            <DiscreteObjectKeyFrame
                                KeyTime="00:00:00">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Visible</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames
                            BeginTime="00:00:00"
                            Duration="00:00:00.0010000"
                            Storyboard.TargetName="groupsView"
                            Storyboard.TargetProperty="(UIElement.Visibility)">
                            <DiscreteObjectKeyFrame
                                KeyTime="00:00:00">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Visible</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames
                            BeginTime="00:00:00"
                            Duration="00:00:00.0010000"
                            Storyboard.TargetName="seasonsView"
                            Storyboard.TargetProperty="(UIElement.Visibility)">
                            <DiscreteObjectKeyFrame
                                KeyTime="00:00:00">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Visible</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames
                            BeginTime="00:00:00"
                            Duration="00:00:00.0010000"
                            Storyboard.TargetName="rankingsButton"
                            Storyboard.TargetProperty="(Control.FontWeight)">
                            <DiscreteObjectKeyFrame
                                KeyTime="00:00:00">
                                <DiscreteObjectKeyFrame.Value>
                                    <FontWeight>Bold</FontWeight>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        <Grid.RowDefinitions>
            <RowDefinition
                Height="auto" />
            <!--logo-->
            <RowDefinition
                Height="auto" />
            <!--main button bar-->
            <RowDefinition
                Height="*" />
            <!--rest of page-->
        </Grid.RowDefinitions>
        <Icons:Logo
            Grid.Row="0" />
        <Rectangle
            Grid.Row="1">
            <Rectangle.Fill>
                <LinearGradientBrush
                    EndPoint="0.5,1"
                    StartPoint="0.5,0">
                    <GradientStop
                        Color="White"
                        Offset="0" />
                    <GradientStop
                        Color="Silver"
                        Offset="1" />
                </LinearGradientBrush>
            </Rectangle.Fill>
        </Rectangle>
        <StackPanel
            x:Name="MainButtonBar"
            Grid.Row="1"
            Orientation="Horizontal">
            <Button
                x:Name="rankingsButton"
                Command="{Binding ShowRankings}"
                HorizontalAlignment="Left"
                Style="{StaticResource MainButton}">
                <StackPanel
                    Orientation="Horizontal">
                    <Icons:RankingsIcon
                        Width="20"
                        Height="20"
                        Margin="2,0,6,0" />
                    <TextBlock
                        Text="Rankings"
                        VerticalAlignment="Center"
                        Foreground="White" />
                </StackPanel>
            </Button>
            <Button
                x:Name="playersButton"
                Command="{Binding ShowPlayers}"
                HorizontalAlignment="Left"
                Style="{StaticResource MainButton}">
                <StackPanel
                    Orientation="Horizontal">
                    <Grid
                        Margin="2,0,6,0">
                        <Icons:PlayerIcon
                            Width="12"
                            Height="20"
                            Margin="-4,-4,0,0"
                            Opacity="0.5"
                            Gender="M" />
                        <Icons:PlayerIcon
                            Width="12"
                            Height="20"
                            Margin="4,4,0,0"
                            Gender="F" />
                    </Grid>
                    <TextBlock
                        Text="Players"
                        VerticalAlignment="Center"
                        Foreground="White" />
                </StackPanel>
            </Button>
            <Button
                x:Name="tournamentsButton"
                Command="{Binding ShowTournaments}"
                HorizontalAlignment="Left"
                Style="{StaticResource MainButton}">
                <StackPanel
                    Orientation="Horizontal">
                    <Grid
                        Margin="2,0,6,0">
                        <Icons:TournamentIcon
                            Width="20"
                            Height="20"
                            Margin="-4,-4,0,0"
                            Opacity="0.5" />
                        <Icons:TournamentIcon
                            Width="20"
                            Height="20"
                            Margin="4,4,0,0" />
                    </Grid>
                    <TextBlock
                        Text="Tournaments"
                        VerticalAlignment="Center"
                        Foreground="White" />
                </StackPanel>
            </Button>
            <Button
                x:Name="selectedPlayerButton"
                Command="{Binding ShowPlayer}"
                HorizontalAlignment="Left"
                Visibility="Collapsed"
                Style="{StaticResource MainButton}">
                <StackPanel
                    Orientation="Horizontal">
                    <Icons:PlayerIcon
                        Width="12"
                        Height="20"
                        Gender="{Binding SelectedPlayer.Gender}"
                        Margin="2,0,6,0" />
                    <TextBlock
                        Text="{Binding SelectedPlayer.LastName}"
                        VerticalAlignment="Center"
                        Foreground="White" />
                    <TextBlock
                        Text=", "
                        VerticalAlignment="Center"
                        Foreground="White" />
                    <TextBlock
                        Text="{Binding SelectedPlayer.FirstName}"
                        VerticalAlignment="Center"
                        Foreground="White" />
                </StackPanel>
            </Button>
            <Button
                x:Name="selectedTournamentButton"
                Command="{Binding ShowTournament}"
                HorizontalAlignment="Left"
                Visibility="Collapsed"
                Style="{StaticResource MainButton}">
                <StackPanel
                    Orientation="Horizontal">
                    <Icons:TournamentIcon
                        Width="20"
                        Height="20"
                        Margin="2,0,6,0" />
                    <TextBlock
                        Text="{Binding SelectedTournament.Name}"
                        VerticalAlignment="Center"
                        Foreground="White" />
                </StackPanel>
            </Button>
        </StackPanel>
        <Grid
            x:Name="RestOfPage"
            Grid.Row="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition
                    Width="Auto" />
                <!--filter column-->
                <ColumnDefinition
                    Width="*" />
                <!--data area-->
            </Grid.ColumnDefinitions>
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition
                        Height="Auto" />
                    <RowDefinition
                        Height="Auto" />
                </Grid.RowDefinitions>
                <Views:SeasonsView
                    x:Name="seasonsView"
                    Grid.Row="0"
                    Margin="0,0,8,0"
                    Visibility="Collapsed"
                    DataContext="{Binding SeasonsViewModel}" />
                <Views:GroupsView
                    x:Name="groupsView"
                    Grid.Row="1"
                    Margin="0,8,8,0"
                    Visibility="Collapsed"
                    DataContext="{Binding GroupsViewModel}" />
            </Grid>
            <Grid
                Grid.Column="1">
                <Grid.RowDefinitions>
                    <RowDefinition
                        Height=" Auto" />
                    <RowDefinition
                        Height="*" />
                </Grid.RowDefinitions>
                <StackPanel
                    x:Name="SelectedSeasonAndGroup"
                    Grid.Row="0"
                    Orientation="Horizontal"
                    HorizontalAlignment="Left">
                    <TextBlock
                        Text="{Binding SelectedSeason}"
                        FontSize="18" />
                    <TextBlock
                        Text=" "
                        FontSize="18" />
                    <TextBlock
                        Text="{Binding SelectedGroup}"
                        FontSize="18" />
                </StackPanel>
                <Grid
                    Grid.Row="1">
                    <Views:PlayersView
                        x:Name="playersView"
                        DataContext="{Binding PlayersViewModel}"
                        Visibility="Collapsed" />
                    <Views:PlayerView
                        x:Name="playerView"
                        DataContext="{Binding SelectedPlayer}"
                        Visibility="Collapsed" />
                    <Views:TournamentsView
                        x:Name="tournamentsView"
                        DataContext="{Binding TournamentsViewModel}"
                        Visibility="Collapsed" />
                    <Views:TournamentView
                        x:Name="tournamentView"
                        DataContext="{Binding SelectedTournament}"
                        Visibility="Collapsed" />
                    <Views:RankingsView
                        x:Name="rankingsView"
                        DataContext="{Binding RankingsViewModel}"
                        Visibility="Collapsed" />
                </Grid>
            </Grid>
        </Grid>
    </Grid>
</UserControl>
